<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>排课系统 API</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
            background-color: #f5f5f5;
        }
        .container {
            background: white;
            padding: 30px;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        h1 {
            color: #333;
            text-align: center;
        }
        .api-list {
            margin-top: 30px;
        }
        .api-item {
            background: #f8f9fa;
            padding: 15px;
            margin: 10px 0;
            border-left: 4px solid #007bff;
            border-radius: 4px;
        }
        .method {
            display: inline-block;
            padding: 4px 8px;
            border-radius: 4px;
            font-weight: bold;
            margin-right: 10px;
        }
        .get { background: #28a745; color: white; }
        .post { background: #007bff; color: white; }
        .put { background: #ffc107; color: black; }
        .delete { background: #dc3545; color: white; }
        .endpoint {
            font-family: monospace;
            font-weight: bold;
        }
        .description {
            margin-top: 5px;
            color: #666;
        }
        .test-button {
            background: #007bff;
            color: white;
            border: none;
            padding: 8px 16px;
            border-radius: 4px;
            cursor: pointer;
            margin-left: 10px;
        }
        .test-button:hover {
            background: #0056b3;
        }
        .response {
            margin-top: 10px;
            padding: 10px;
            background: #e9ecef;
            border-radius: 4px;
            font-family: monospace;
            white-space: pre-wrap;
            max-height: 200px;
            overflow-y: auto;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>排课系统 API 文档</h1>
        <p>欢迎使用排课系统后端API服务。以下是可用的API端点：</p>
        
        <div class="api-list">
            <h3>教室管理 API</h3>
            <div class="api-item">
                <span class="method get">GET</span>
                <span class="endpoint">/room/listPage</span>
                <button class="test-button" onclick="testAPI('/room/listPage?pageNum=1&pageSize=10')">测试</button>
                <div class="description">分页查询教室数据（支持按教室名称、容量、校区ID筛选）</div>
                <div class="response" id="response-room-listPage" style="display: none;"></div>
            </div>
            
            <div class="api-item">
                <span class="method get">GET</span>
                <span class="endpoint">/room/select</span>
                <button class="test-button" onclick="testAPI('/room/select?id=1')">测试</button>
                <div class="description">根据ID查询教室数据</div>
                <div class="response" id="response-room-select" style="display: none;"></div>
            </div>
            
            <div class="api-item">
                <span class="method post">POST</span>
                <span class="endpoint">/room/save</span>
                <div class="description">保存教室数据（需要JSON请求体：roName, roCapacity, roCampusId, roRemark）</div>
            </div>
            
            <div class="api-item">
                <span class="method put">PUT</span>
                <span class="endpoint">/room/update</span>
                <div class="description">修改教室数据（需要JSON请求体：roId, roName, roCapacity, roCampusId, roRemark）</div>
            </div>
            
            <div class="api-item">
                <span class="method delete">DELETE</span>
                <span class="endpoint">/room/delete</span>
                <button class="test-button" onclick="testAPI('/room/delete?id=1')">测试</button>
                <div class="description">删除教室数据</div>
                <div class="response" id="response-room-delete" style="display: none;"></div>
            </div>
        </div>
        
        <div class="api-list">
            <h3>其他管理 API</h3>
            <div class="api-item">
                <span class="method get">GET</span>
                <span class="endpoint">/class/listPage</span>
                <button class="test-button" onclick="testAPI('/class/listPage?pageNum=1&pageSize=10')">测试</button>
                <div class="description">分页查询班级数据</div>
                <div class="response" id="response-class-listPage" style="display: none;"></div>
            </div>
            
            <div class="api-item">
                <span class="method get">GET</span>
                <span class="endpoint">/student/listPage</span>
                <button class="test-button" onclick="testAPI('/student/listPage?pageNum=1&pageSize=10')">测试</button>
                <div class="description">分页查询学生数据</div>
                <div class="response" id="response-student-listPage" style="display: none;"></div>
            </div>
            
            <div class="api-item">
                <span class="method get">GET</span>
                <span class="endpoint">/teacher/listPage</span>
                <button class="test-button" onclick="testAPI('/teacher/listPage?pageNum=1&pageSize=10')">测试</button>
                <div class="description">分页查询教师数据</div>
                <div class="response" id="response-teacher-listPage" style="display: none;"></div>
            </div>
            
            <div class="api-item">
                <span class="method get">GET</span>
                <span class="endpoint">/course/listPage</span>
                <button class="test-button" onclick="testAPI('/course/listPage?pageNum=1&pageSize=10')">测试</button>
                <div class="description">分页查询课程数据</div>
                <div class="response" id="response-course-listPage" style="display: none;"></div>
            </div>
        </div>
        
        <div class="api-list">
            <h3>课程计划管理 API</h3>
            <div class="api-item">
                <span class="method get">GET</span>
                <span class="endpoint">/coursePlan/listPage</span>
                <button class="test-button" onclick="testAPI('/coursePlan/listPage?pageNum=1&pageSize=10')">测试</button>
                <div class="description">分页查询课程计划数据（支持按课程ID、班级ID、教师ID、教室ID、星期等筛选）</div>
                <div class="response" id="response-coursePlan-listPage" style="display: none;"></div>
            </div>
            
            <div class="api-item">
                <span class="method get">GET</span>
                <span class="endpoint">/coursePlan/select</span>
                <button class="test-button" onclick="testAPI('/coursePlan/select?id=1')">测试</button>
                <div class="description">根据ID查询课程计划数据</div>
                <div class="response" id="response-coursePlan-select" style="display: none;"></div>
            </div>
            
            <div class="api-item">
                <span class="method post">POST</span>
                <span class="endpoint">/coursePlan/save</span>
                <div class="description">保存课程计划数据（需要JSON请求体：cpCourseId, cpClassId, cpTeacherId, cpRoomId, cpStartTime, cpEndTime, cpWeekday, cpRemark）</div>
            </div>
            
            <div class="api-item">
                <span class="method put">PUT</span>
                <span class="endpoint">/coursePlan/update</span>
                <div class="description">修改课程计划数据（需要JSON请求体：cpId, cpCourseId, cpClassId, cpTeacherId, cpRoomId, cpStartTime, cpEndTime, cpWeekday, cpRemark）</div>
            </div>
            
            <div class="api-item">
                <span class="method delete">DELETE</span>
                <span class="endpoint">/coursePlan/delete</span>
                <button class="test-button" onclick="testAPI('/coursePlan/delete?id=1')">测试</button>
                <div class="description">删除课程计划数据</div>
                <div class="response" id="response-coursePlan-delete" style="display: none;"></div>
            </div>
        </div>
        
        <div class="api-list">
            <h3>教师个人中心 API</h3>
            <div class="api-item">
                <span class="method get">GET</span>
                <span class="endpoint">/teacher/personal/info</span>
                <button class="test-button" onclick="testAPI('/teacher/personal/info?teacherId=1')">测试</button>
                <div class="description">根据教师ID获取个人信息</div>
                <div class="response" id="response-teacher-personal-info" style="display: none;"></div>
            </div>
            
            <div class="api-item">
                <span class="method get">GET</span>
                <span class="endpoint">/teacher/personal/info/byNo</span>
                <button class="test-button" onclick="testAPI('/teacher/personal/info/byNo?teNo=10001')">测试</button>
                <div class="description">根据工号获取个人信息</div>
                <div class="response" id="response-teacher-personal-info-byno" style="display: none;"></div>
            </div>
            
            <div class="api-item">
                <span class="method put">PUT</span>
                <span class="endpoint">/teacher/personal/update</span>
                <div class="description">更新教师个人信息</div>
            </div>
            
            <div class="api-item">
                <span class="method patch">PATCH</span>
                <span class="endpoint">/teacher/personal/update/basic</span>
                <div class="description">更新教师基本信息（部分字段）</div>
            </div>
        </div>
        
        <div style="margin-top: 30px; padding: 20px; background: #e7f3ff; border-radius: 4px;">
            <h3>说明</h3>
            <p>这是一个纯后端API服务，不包含前端界面。如果您需要前端界面，请：</p>
            <ul>
                <li>使用Vue.js、React、Angular等前端框架</li>
                <li>通过AJAX/Fetch调用上述API接口</li>
                <li>确保前端应用运行在不同的端口（如3000），后端运行在8090端口</li>
            </ul>
            <p>
                <a href="/teacher-test.html" target="_blank" style="color: #007bff; text-decoration: none;">🧪 数据测试页面</a>
            </p>
        </div>
    </div>

    <script>
        async function testAPI(url) {
            const responseId = 'response-' + url.replace(/\//g, '-').replace(/\?.*/, '');
            const responseDiv = document.getElementById(responseId);
            
            try {
                const response = await fetch(url);
                const data = await response.text();
                
                responseDiv.textContent = `状态码: ${response.status}\n响应: ${data}`;
                responseDiv.style.display = 'block';
            } catch (error) {
                responseDiv.textContent = `错误: ${error.message}`;
                responseDiv.style.display = 'block';
            }
        }
    </script>
</body>
</html>

